#include<iostream>
using std::cout; using std::endl; using std::cin;
#include<string>
using std::string;
#include<vector>
using std::vector;
class Transaction {
    public:
        Transaction();
        virtual void logTransaction() const = 0;
    private:
        int amount;
        double prices;
        string type;
        void init();
};

Transaction::Transaction(){ 
    init();
}


// void Transaction::init(){
//     logTransaction();
// }

void Transaction::logTransaction() const{
    cout << "Transaction::logTransaction" << endl;
    cout << type << endl;   
}

//why author don't build construct of BuyTransaction directly?

class BuyTransaction: public Transaction {
    public:
        // BuyTransaction();
        virtual void logTransaction() const;
};
// BuyTransaction::BuyTransaction(){
//     logTransaction();   
// }

void BuyTransaction::logTransaction() const{
    cout << "BuyTransaction::logTransaction" << endl;   
}

class SellTransaction : public Transaction{
    public:
        virtual void logTransaction() const;
};
// void SellTransaction::logTransaction() const{
//     cout << "SellTransaction::logTransaction" << endl;   
// }

int main(){
    // why the BuyTranscation version of b doesn't called?
    BuyTransaction b;
}